#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
@Author: shijianbo
@Email:
@Time: 2022/7/12 14:36
@File: oceanbase.py
"""
import jaydebeapi

from .basic import DatabaseUtil



class OceanBaseUtil(DatabaseUtil):

    def __init__(self, user, password, ip, port=3306, **kwargs):
        self.CURSOR = {}
        jclassname = 'com.alipay.oceanbase.jdbc.Driver'
        url = f"jdbc:oceanbase://{ip}:{port}"
        driver_args = [user, password]
        jar_ile = kwargs.get("jar_files")
        self.db = jaydebeapi.connect(jclassname, url, driver_args, jar_ile)
        self.db.jconn.setAutoCommit(False)

